import request from "@/utils/request.js";
import {useTokenStore} from "@/Stores/token.js";
export const mangerRegisterService = (registerData)=>{
    const params =    new URLSearchParams()
    for (let key in registerData){
        params.append(key, registerData[key]);
    }
    return  request.post('/manger/register',params)
}
export const mangerLoginService = (loginData)=>{
    const params = new URLSearchParams()
    for (let key in loginData){
        params.append(key, loginData[key]);
    }
    return request.post('/manger/UsernameByLogin',params)
}
export const mangerListService =(params)=>{
    const tokenStore = useTokenStore();
    return request.get('/manger',{params:params})
}
export  const userResetPaService = (userInfo,token)=>{
    return request({
        url: '/manger/resetPwd',
        method: 'PATCH',
        data: userInfo,
        headers: {
            'Content-Type': 'application/json',
            'Authorization': token
        }
    });
}
export const sendVc =(forgetData)=>{
    const params =    new URLSearchParams()
    for (let key in forgetData){
        params.append(key, forgetData[key]);
    }
    return request.post('/manger/init',params)

}
export const getVc =(forgetData)=>{
    const params =    new URLSearchParams()
    for (let key in forgetData){
        params.append(key, forgetData[key]);
    }
    return request.get('/manger/getvc',{ params })
}

export const updateForgetPwd =(forgetData)=>{
    const params =    new URLSearchParams()
    for (let key in forgetData){
        params.append(key, forgetData[key]);
    }
    return request.patch('/manger/updateForgetPwd',params)
}
